<!DOCTYPE html>
<html>
<head>
          <meta charset="utf-8"/>
          <title>个人中心</title>
          <style type="text/CSS">
                   body
                   {
                     background-color:skyblue;
                   }
                   form
                   {
                      margin-left:5%;
                      margin-top:2%;
                   }
                   
                   table,tr
                   {
                           width:70%;
                   }
                    td
                    {
                      width:10%;
                      height:50px;
                      font-size:20px;
                    }
                    
                    td:last-child
                    {
                      width:   40%;
                    }
                    
                    input[type="text"] 
                    {
                      width:90%;
                      height:70%;
                      border-radius:10px;
                      
                    }
                    img
                    {
                       position:absolute;
                       left:80%;   
                       border-radius:50%;
                    }
                    select
                    {
                      width:30%;
                      height:30px;
                      border-radius:10px;
                    }
          </style>
    <script src="jQuery.js"></script>
</head>
<body>       
                <img src="images/光哥.jpg" alt="这是你的头像"/>
            <form name="my_form" action="#" method="get" id="myform">
                  <table>
                          
                         <tr>
                             <td><h1>基本信息</h1></td>
                         </tr>

                  </table>  
                   
                  <table>
                     
                          <tr>
                             <td>工号</td>
                             <td>
                               
                                  <input type="text" name="gonghao" >
                          
                             </td>
                             </tr>

                             <tr>
                             <td>姓名</td>
                             <td>

                                  <input type="text" name="tname">

                             </td>
                             </tr>

                             <tr>
                             <td>性别</td>
                             <td>
    
                                <input type="text" name="sex">

                             </td>
                             </tr>

                             <tr>
                             <td>身份证号</td>
                             <td>

                                 <input type="text" name="IDcard">

                             </td>
                             </tr>
                             <tr>
                             <td>籍贯</td>
                             <td>

                                  <input type="text" name="jiguan">

                              </td>
                              </tr>

                              <tr>
                              <td>出生日期</td>
                              <td>
           
                                 <input type="text" name="birth">

                               </td>
                               </tr>
                           
                </table>

                <hr/>
              
                <table>
                          
                         <tr>
                             <td>在校信息</td>
                         </tr>

                  </table>  
 
                   <hr/>

                  <table>
           
                       <tr>
                       <td>入教日期</td>
                       <td>

                           <input type="text" name="riqi">

                       </td>
                       </tr>

                       <tr>
                       <td>在职学院</td>
                       <td>
                           <input type="text" name="xueyuan">

                       </td>
                       </tr>


                      <tr>
                          <td>级别</td>
                          <td>

                              <input type="text" name="jibie">

                          </td>
                      </tr>
                        <tr>
                        <td>班级</td>
                        <td>

                            <input type="text" name="banji">

                        </td>
                        </tr>

                      </table>
                     <hr/>   
                      </form>
</body>
<script>
    var userid='<%=userid%>';
    window.onload=function () {
        var data={"userid":userid};
        $.ajax({
            data:data,
            url:"/Center_back/teacher",
            dataType:"json",
            success:function (data,type) {

                if(type=="success"){
                    var str=Object.keys(data);
                    var inputdom =  $('input');
                    var inlen=inputdom.length;


                    for(var i=0;i<inlen;i++){
                        for(var j=0;j<=str.length;j++)
                        {
                            var po=str[j];
                            if(inputdom[i].name == "riqi"&&inputdom[i].name==po)
                            {
                                var tempdate = new Date(data[po]);
                                inputdom[i].value = tempdate.getUTCFullYear() +'-'+(tempdate.getMonth()+1)+'-'+tempdate.getDate();
                                continue;
                            }
                            if(inputdom[i].name==po){
                                inputdom[i].value=data[po];
                            }
                        }
                    }
                    $('#myform input').attr("disabled","disabled");
                    $('#myform select').attr("disabled","disabled");
                }
            }
        });
    };

</script>
</html>